<template>
  <div style="height: 100%;width: 100%;">

    <el-table
      :data="unprocessedQuestions"
      border
      style="width: 100%; height: calc(100%);"
      :height="tableHeight"
      :row-style="{ height: '40px' }"
      :cell-style="{ padding: '0' }">
      <el-table-column
        fixed
        prop="hospitalNumber"
        label="住院号"
        min-width=20%>
      </el-table-column>
      <el-table-column
        prop="exception"
        label="预警信息"
        min-width="60%">
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作"
        min-width="20%">
        <template v-slot:default="scope">
          <!-- <el-button  @click="handleClick(scope.row)" type="text" size="medium">查看</el-button> -->
          <el-button type="text" size="medium">查看</el-button>
          <el-button type="text" size="medium">处理</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { apiClient } from '../api/apiClient.ts' // 引入 apiClient 实例

export default {
  data() {
    return {
      unprocessedQuestions: [] // 用于存储从后端获取的数据
    };
  },
  created() {
    this.fetchData();
  },
  methods: {
    fetchData() {
      apiClient.get('/doctor/getPatientExceptionList')
        .then(response => {
          if (response.data.code === 1) {
            this.unprocessedQuestions = response.data.data; // 从 data 字段中提取数据
            console.log('Unprocessed questions:', this.unprocessedQuestions);
          } else {
            console.error('Failed to fetch unprocessed questions:', response.data.msg);
          }
        })
        .catch(error => {
          console.error('Failed to fetch unprocessed questions:', error);
        });
    },
    handleClick(row) {
      console.log('Row clicked:', row);
      // 你可以在这里处理点击事件，例如跳转到详细页面
    }
  }
};
</script>

<style scoped>
h1 {
  margin-bottom: 0px;
}
</style>